home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
113
/
gfatip08
/
gfatip08.doc
< prev
next >
Wrap
Text File
|
1987-09-25
|
4KB
|
98 lines
September 7, 1987
GFATIP08.DOC
by John B. Holder
Senior Software Engineer
Marathon Computer Press
Asst. Sysop on GEnie's MichTron Roundtable
This is the 8th in a planned series of GFA Tip files. This is
the latest in the series designed to assist the GFA Basic
programmer in getting the most out of his computing dollar. The
topic of this issue is timing of software execution speeds. In
this archive you will find the following files:
Timer.Prg => Actual timing program
Command.Tos => PD CLI program {From GEMBOOT2}
Timetest.Prg => GFA Basic Compiled Program
Timetest.Bas => GFA Basic Source Code for the timetest program
Dialtest.Prg => Compiled GFA Companion Dialog Box
GFATIP08.DOC => This file
In past GFA Basic Conferences the question has arisen many
times, "How do I time the total execution speed of a program or
software procedure?". This set of utilities is designed to help
you do just that. You can time a critical routine within a
project you are working on to get an idea of execution times, and
with a bit of practice you can learn to optimize your code to make
it run faster. The soon to be released "GFA Book" will help you
even more in this endeavor. It will be available from MichTron in
a month or so.
Command.Tos:
To run the CLI just double click from the desktop. When the
prompt appears, you may enter ? to see a listing of supported
commands within the CLI. It's sole purpose is to allow you to
execute the Timer.Prg and pass a command line to it. To execute
the sample GFA Basic program included enter the following at the
CLI prompt:
timer timetest.prg
or
timer dialtest.prg
Timer.Prg:
This program was written in C and is designed to time
sections of compiled code for you. You must remember the
following to be successful with the timer.
1) Always enter the extension of the program you wish to
time, eg.. timetest.(prg)(tos)(ttp)
2) Since it is futile to time a program that uses GEM
interaction, that has been disallowed. It is useless to time a
piece of code you wish to optimize if there are GEM menus or Alert
Boxes in it. The overall idea here is to produce fast code that
can be accurately timed. If you happen to accidentally include a
section of code that has an alert box in it, you may exit if you
have included a hot button to abort with the return key. So keep
it in mind that if you have Alert boxes, menus, or Non-GFA
Companion Dialog boxes {You may test sections of code that utilize
GFA Companion generated Dialog Boxes} that utilize the GEM AES,
you will have to reboot your system. The use of the mouse is not
affected in most cases if the code section uses a Showm at the top
of the procedure that requires it. Only the mouse interaction
with the AES is affected.
By including the above exclusion, I am not attempting to
shoot down GEM at all (I happen to like GEM). This utility is
for testing sections of code that utilize a lot of math, I/O, or
printing routines. Use the timetest.bas program for an example.
By using Timer.Prg with sections of code that have been compiled,
you may be able to experiment and speed up critical sections of
your program. You can experiment with Loops, For Next, Inc, Add,
or whatever you believe will help to speed up execution times &
Timer.prg will help you to keep a track record of performance.
These crucial sections of code can then be included in a Fully GEM
based program at a later time.
I hope that this helps you to optimize your code, and create
faster running GFA Basic programs.
John B. Holder
Notice:
Feel free to u/l this ARC'hive anywhere you like, however
please do so in it's entirety. Timer.Prg is (c)1987 Marathon
Computer Press and may not be sold without prior approval of owner
of copyright.